var panel_tog = function(state, e) {
	var main_panel = document.getElementById('main_panel');
	var btn = document.getElementById('main_panel_btn');
	var sub_panel = document.getElementById('sub_panel');
	
	if (e) {
		e.stopPropagation();
	}
	
	if (state == 0) {
		main_panel.className = '';
		btn.className = 'panel_btn';
	} else if (state == 1) {
		main_panel.className = 'slide';
		btn.className = 'panel_btn open';
	} else {
		if (!main_panel.className) {
			main_panel.className = 'slide';
			btn.className = 'panel_btn open';
		} else if (main_panel.className === 'slide') {
			main_panel.className = '';
			btn.className = 'panel_btn';
		} else {
			main_panel.className = '';
			btn.className = 'panel_btn';
		}
	}
};